-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add LSP for groovy #4303
Add LSP for groovy #4303
Conversation
There seems to be a separate grammar in development here? I'm not sure how different groovy is from Java https://github.com/codieboomboom/tree-sitter-groovy |
file-types = ["groovy", "gvy", "gy", "gsh"] | ||
comment-token = "//" | ||
indent = { tab-width = 2, unit = " " } | ||
language-server = { command = "java", args = ["-jar", "/Users/zephaniahong/Desktop/groovy-language-server/build/libs/groovy-language-server-all.jar"]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is hard coded to your setup and shouldn't be upstreamed in this way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup! I'm just testing things out to get a better understanding. But the main issue is that, I can't get the syntax highlighting to work
Try using inherits instead in the same way this was done for purescript 2d958d6 |
Tried it but still does not seem to work. I've ensured that I've sync all my grammars by running the mentioned commands but I still get the same error |
If you use tree-sitter-groovy then you need to write queries specific to that implementation and can't just reuse the Java ones. |
I see! I'll give that a shot. The only way I've gotten syntax highlighting to work for groovy is by add the groovy file extension to the java language. Thank you! |
[[grammar]] | ||
name = "groovy" | ||
source = { git = "https://github.com/tree-sitter/tree-sitter-java", rev = "bd6186c24d5eb13b4623efac9d944dcc095c0dad" } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You either need to use grammar = "java"
in the [[language]]
block or use a tree-sitter-groovy
parser - this will fail to load because we're expecting the parsing to expose symbols under the name tree_sitter_groovy
but this parser uses tree_sitter_java
:
helix/helix-loader/src/grammar.rs
Line 76 in 2457111
let language_fn_name = format!("tree_sitter_{}", name.replace('-', "_")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably raise this log level so it shows up in the log by default, as long as this doesn't start showing up in test output:
helix/helix-core/src/syntax.rs
Line 371 in 2457111
.map_err(|e| log::info!("{}", e)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see! I think I understand now(: Thanks!
Also, what do you mean by 'as long as this doesn't start showing up in test output'? Would changing it to log::warning!("{}", e)
solve what you're saying?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the test suite, it isn't actually a problem. The integration tests will print log lines but there isn't an integration test where this returns Error
I don't think groovy is close enough to java syntax-wise to use tree-sitter-java |
Yupp! But I just wanted to play around to make sure I understood the mechanics of how things were working. Once I wrap my head around it, I'll swap it out with tree-sitter-groovy and write queries for it. |
Info logs don't show up in the log file by default, but this line should: failures to load tree-sitter parser objects are useful errors. A parser might fail to load it is misconfigured (#4303 (comment)) or if the file does not exist.
Info logs don't show up in the log file by default, but this line should: failures to load tree-sitter parser objects are useful errors. A parser might fail to load it is misconfigured (#4303 (comment)) or if the file does not exist.
Info logs don't show up in the log file by default, but this line should: failures to load tree-sitter parser objects are useful errors. A parser might fail to load it is misconfigured (helix-editor#4303 (comment)) or if the file does not exist.
Info logs don't show up in the log file by default, but this line should: failures to load tree-sitter parser objects are useful errors. A parser might fail to load it is misconfigured (helix-editor#4303 (comment)) or if the file does not exist.
#4211
Hi! @the-mikedavis
I'm trying to implement LSP and syntax highlighting for groovy. The LSP sorta works though it seems a little slow. But my main problem is trying to implement syntax highlighting. I tried copying the entire
highlights.scm
andinjections.scm
from java just to test things out but even that did not work. Any advice?Thank you!